import 'package:fluro/fluro.dart';
import 'package:fluro/src/router.dart';
import 'package:flutter_shop/cons/global_cons.dart';
import 'package:flutter_shop/pages/cart/cart_tab_page/entity/cart_goods_data.dart';
import 'package:flutter_shop/pages/cart/order_confirm/order_confirm_page.dart';
import 'package:flutter_shop/routers/router_init.dart';
import 'package:flutter_shop/utils/utils.dart';

class CartRouter implements IRouterProvider {
  ///订单确认
  static const String orderConfirm = "/cart/orderConfirm";

  @override
  void initRouter(Router router) {
    ///订单确认
    router.define(orderConfirm, handler: Handler(handlerFunc: (context, params) {
      String json = params[GlobalCons.KEY_DATA].first;
      List<CartGoodsData> list = Utils.parseJson2ObjList(json, (v) => CartGoodsData().fromJson(v), defValue: []);
      return OrderConfirmPage(list: list);
    }));
  }
}
